/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Utility.CustomTag;

import java.io.IOException;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.tagext.SimpleTagSupport;

/**
 *
 * @author Tran Nguyen Anh Tu
 */
public class GenderSelectorTag extends SimpleTagSupport {

    public void setGender(int gender) {
        this.gender = gender;
    }
    private int gender;
    
    private void writeOutput() throws IOException, JspException {
        JspWriter out = getJspContext().getOut();
        out.write("<select name=\"gender\">");
        if (gender==1) {
            out.write("<option selected value=\"1\">Nam</option>");
            out.write("<option value=\"0\">Nữ</option>");
        } else {
            out.write("<option value=\"1\">Nam</option>");
            out.write("<option selected value=\"0\">Nữ</option>");
        }
        out.print("</select>");
    }
    @Override
    public void doTag() throws IOException, JspException {
        this.writeOutput();
    }
}
